<?php
App::uses('AppModel', 'Model');
/**
 * Power Model
 *
 * @property Group $Group
 * @property LogLine $LogLine
 * @property Character $Character
 */
class Power extends AppModel {
/**
 * Validation rules
 *
 * @var array
 */
// TODO: check all validation
	public $validate = array(
//		'type' => array(),
//		'group_id' => array(),
		'expiry' => array(
			'date' => array(
				'rule' => 'date',
				'message' => 'Enter a valid date',
				'allowEmpty' => true
			),
		),
		'name' => array(
			'notEmpty' => array(
				'rule' => array('notempty'),
				'message' => 'All powers and conditions must have name',
			),
		),
		'player_text' => array(),
		'cs_text' => array(),
		'deleted' => array(
			'boolean' => array(
				'rule' => array('boolean'),
				'message' => 'You should not be seeing this message. Deleted should be true or false.',
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
	public $belongsTo = array(
		'Group' => array(
			'className' => 'Group',
			'foreignKey' => 'group_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'LogLine' => array(
			'className' => 'LogLine',
			'foreignKey' => 'power_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);


/**
 * hasAndBelongsToMany associations
 *
 * @var array
 */
	public $hasAndBelongsToMany = array(
		'Character' => array(
			'className' => 'Character',
			'joinTable' => 'characters_powers',
			'foreignKey' => 'power_id',
			'associationForeignKey' => 'character_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		)
	);

}
